package com.parkingspace.controller;


import com.parkingspace.entity.Car;
import com.parkingspace.service.ICarService;
import com.parkingspace.util.Constants;
import com.parkingspace.util.ResultVO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 车辆信息表 前端控制器
 * </p>
 *
 * @author Gapper
 * @since 2021-05-24
 */
@RestController
@RequestMapping("/car")
public class CarController {
    @Resource
    private ICarService iCarService;

    @PostMapping("selectcarByUid")
    public ResultVO selectcarByUid(Car car){
        List<Car> cars = iCarService.getCarByUId(car.getUid());
        return new ResultVO(Constants.OPER_SUCCESS,"成功",cars);
    }

    @PostMapping("addcar")
    public ResultVO addcar(String plateNumber,String drivingPermitNo,String remark,Long uid){
       Boolean flag =  iCarService.addCar(plateNumber,drivingPermitNo,remark,uid);
        return new ResultVO(Constants.OPER_SUCCESS,"",flag);
    }

}

